package com.youhome.housing.handler;

import com.youhome.common.exception.CustomException;
import com.youhome.common.response.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created by chen365 on 2019/01/23.
 */
@RestControllerAdvice
@Slf4j
public class HousingCustomExceptionHandler {

    @ExceptionHandler(CustomException.class)
    @ResponseStatus(HttpStatus.OK)
    public Object handlerCustomException(CustomException ex) {
        System.err.println("handlerCustomException");
        return new Result<>(ex.getResultCode());
    }
}
